package mill;
import java.util.Date;
import java.util.Calendar;
import java.io.Serializable;
import mill.*;
import mill.components.*;
import mill.measurePoints.*;

public class MillFactory implements Serializable {
	
	public IMill createMill(int id, MillType type)
	{
		IMill mill;

		Calendar cal = Calendar.getInstance();
		Date now = cal.getTime();
		switch (type) {
		case Small:
			mill = new ConcreteMill(25,id,type,30);
			mill.addComponents(new Wing(now, "WingFab", 15));
			mill.addComponents(new Wing(now, "WingFab", 15));
			mill.addComponents(new Generator(now, "B&W"));
			mill.addComponents(new Gear(now,"BMW",2));
			mill.addComponents(new Computer(now,"Commodoer",1));
			mill.addMeasurePoint(new AirTemperature(now,"World",AirTemperature.TemperatureScale.Celsius));
			mill.addMeasurePoint(new WindDirection(now,"Wind"));
			mill.addMeasurePoint(new Windspeed(now,"Wind"));
			
			break;
		case Medium:
			mill = new ConcreteMill(50,id,type,60);
			mill.addComponents(new Wing(now, "WingFab", 30));
			mill.addComponents(new Wing(now, "WingFab", 30));
			mill.addComponents(new Wing(now, "WingFab", 30));
			mill.addComponents(new Generator(now, "B&W"));
			mill.addComponents(new Gear(now,"BMW",5));
			mill.addComponents(new Computer(now,"Amiga",3));
			mill.addMeasurePoint(new AirTemperature(now,"World",AirTemperature.TemperatureScale.Celsius));
			mill.addMeasurePoint(new WindDirection(now,"Wind"));
			mill.addMeasurePoint(new Windspeed(now,"Wind"));
			
			break;
		case Large:
			mill = new ConcreteMill(75,id,type,120);
			mill.addComponents(new Wing(now, "WingFab", 60));
			mill.addComponents(new Wing(now, "WingFab", 60));
			mill.addComponents(new Wing(now, "WingFab", 60));
			mill.addComponents(new Generator(now, "B&W"));
			mill.addComponents(new Gear(now,"BMW",10));
			mill.addComponents(new Computer(now,"IBM",8));
			mill.addMeasurePoint(new AirTemperature(now,"World",AirTemperature.TemperatureScale.Celsius));
			mill.addMeasurePoint(new WindDirection(now,"Wind"));
			mill.addMeasurePoint(new Windspeed(now,"Wind"));
			
			break;
		default:
			mill = null;
			break;
		}

		return mill;
	}
	
}
